﻿CREATE FUNCTION [dbo].[WeekEnd](
	@Date datetime
)RETURNS datetime WITH SCHEMABINDING
AS
BEGIN 
RETURN DATEADD(dd,-DATEPART(dw,@Date),DATEDIFF(dd,0,@Date))+7.99999
END
